package com.example.demo.controller;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 张好佳
 * @Date 2020/10/15 3:14 下午
 **/
@RestController
@RequestMapping("/demo")
public class DemoController {

    @ApiOperation(value = "测试参数", response = String.class)
    @ApiResponses(@ApiResponse(code = 200, message = "OK"))
    @GetMapping("/test/{param}")
    public ResponseEntity<String> test(@PathVariable("param") String param){
        return new ResponseEntity(param,HttpStatus.BAD_REQUEST);
    }

    @ApiOperation(value = "测试", response = String.class)
    @ApiResponses(@ApiResponse(code = 200, message = "OK"))
    @GetMapping("/new/{param}")
    public ResponseEntity<String> test1(@PathVariable("param") String param){
        return new ResponseEntity(param,HttpStatus.BAD_REQUEST);
    }
}
